function OnScreenshotClick(event, element){
    if ( !this.m_bScreenshotModalActive )
    {
        var $Link = $(element);
        var screenshotid = $Link.data('screenshotid');
        // alert($(element).next().text());
        var screentext = $(element).next().text();
        showScreenshotPopup(screenshotid, screentext);
    }

    event.preventDefault();
}
function showScreenshotPopup(screenshotid, screentext){

    var $modal = $('<div/>', {'class':'screenshot_popup_modal'});
    var $title = $('<a/>').css('color','#222d3d');
    $title.attr('href',screenshotid);
    $title.attr('target',"_blank");
    $title.text('下载完整大小的版本');
    $title.append('',$('<img/>'), {src:'https://store.st.dl.bscstorage.net/public/images/v5/ico_external_link.gif'})

    $titleCtn = $('<div/>', {'class': 'screenshot_popup_modal_title'}).append($title);

    var $img = $('<img/>',{'src':screenshotid,'size':'600x338'});
    // var imgPreload = $('<img/>',{'src':''})
    var $imgCtn = $('<div/>', {'class': 'screenshot_img_ctn'}).append($img);

    var $showTip = $('<p/>').text('↓ 滑 动 查 看 更 多 ↓').css({
        "color":'#D5D4D4',
        'text-align': 'center',
        'font-size': '18px',
        'margin': '0.5em 0'
    });
    var $imgTextTitle = $('<p/>').text('图片详情').css('font-size','18px');
    var $imgMainText = $('<p/>').text(screentext);

    var $imgText = $('<div/>',{'class':'screenshot_text_ctn'}).append($imgTextTitle, $imgMainText);


    $modal.append($('<div/>', {'class':'screenshot_popup_modal_content screenshot-scroll'}).append(
        $titleCtn,
        $imgCtn,
        $showTip,
        $imgText
    ));



    $('body').append($modal);
    $modal.css({
        "z-index":1000,
        "left":$(window).width()/2 - $modal.width()/2,
        "top":$(window).scrollTop() + $(window).height()/2 - $modal.height()/2
    })

    $('.newmodal_background').css("display","block");

    $('.newmodal_background').click(function(){
        $('.screenshot_popup_modal').remove();
        $(this).css("display","none")
    })

    resize($modal);
    
    // $img.load( function() {
    // $imgCtn.css( 'min-width', '' );
    // $imgCtn.css( 'min-height', '' );
    // $img.stop();
    // $img.fadeTo( 'fast', 1.0 );

    // } );
}




function resize(element){

    $(document).scroll(function(){
        $(element).css({
            "top":$(window).scrollTop() + $(window).height()/2 - $(element).height()/2
        })
    });

    $(window).resize(function() {
        $(element).css({
            "left":$(window).width()/2 - $(element).width()/2
        })
    });
}